package com.cf.conf.core;

import com.cf.conf.core.model.Config;
import com.cf.util.ObjectJsonUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;

import java.io.IOException;

/**
 * game-server-UpdateListener
 *
 * @author <a href="2428922347@qq.com">Zhu mingming</a>
 * @info
 * @since 2018/6/8 下午 04:28
 */
@Slf4j
public class UpdatePusher {


    @Autowired
    private StringRedisTemplate redisTemplate;

    public void push(Config config) throws IOException {
        redisTemplate.convertAndSend(config.getApp() + "-" + config.getProfile(), ObjectJsonUtil.toString(config));
    }

}
